<?php
class first{
	function FirstNotRepeatingChar($str){
		$p = '';
		//将字符串变成数组
		$arr = str_split($str,1);
		$count = count($arr);
		for ($i=0; $i<$count; $i++) { 
			$k = $arr[$i];
			//查询第一次出现的位置
			$n = strpos($str,$k);
			//print_r($n);
			$m = strrpos($str,$k);
			//print_r($m);
			if($n==$m){
				$p=$k;
			}else $p=-1;

		}
		return $p;
	}
}

$data = new first;
print_r($data->FirstNotRepeatingChar('aaaAbbbbKKKkCCCeedd'));
?>